home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 47215 / 47215.xpi / chrome / content / lib / windows.js < prev   
Text File  |  2009-11-22  |  856b  |  30 lines

  1. (function()
  2. {
  3.     //returns the focused window
  4.     this.windowGetFocused = function()
  5.     {
  6.         //dispatch the event to the extension
  7.             var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]  
  8.                         .getService(Components.interfaces.nsIWindowMediator);  
  9.             return wm.getMostRecentWindow('navigator:browser');
  10.     }
  11.     //returns an array of navigator:browser
  12.     this.windowsGet = function()
  13.     {
  14.         var windows = [];
  15.         var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
  16.                     .getService(Components.interfaces.nsIWindowMediator);
  17.         var enumerator = wm.getEnumerator('navigator:browser');
  18.         while(enumerator.hasMoreElements())
  19.         {
  20.             var win = enumerator.getNext();
  21.             // win is [Object ChromeWindow] (just like window), do something with it
  22.             windows[windows.length] = win;
  23.         }
  24.         return windows;
  25.     }
  26.  
  27.     return null;
  28.  
  29. }).apply(URLtoTabTitle);
  30.